Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change timezone.now to timezone.localtime #159

Merged
merged 2 commits into from
Jun 29, 2024
Merged

Conversation

yukitya-1811
Copy link
Contributor

Description

Basic fix for timezone.now, changing it to timezone.localtime

Fixes #158

Type of Change

What types of changes does your code introduce?
Put an x in the boxes that apply

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link

render bot commented Jun 19, 2024

@anirudhprabhakaran3 anirudhprabhakaran3 merged commit fb1da4c into main Jun 29, 2024
1 check passed
@anirudhprabhakaran3 anirudhprabhakaran3 deleted the timezone-fix branch June 29, 2024 14:14
Copy link
Member

@nishant-nayak nishant-nayak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be fixed. Reopening issue #158

@@ -140,7 +140,7 @@ class ExecutiveMember(models.Model):
)
is_nep = models.BooleanField(default=False, verbose_name="Is NEP Member?")
date_joined = models.DateTimeField(
default=timezone.now(), verbose_name="Date Joined"
default=timezone.localtime(), verbose_name="Date Joined"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default=timezone.localtime(), verbose_name="Date Joined"
default=timezone.localtime, verbose_name="Date Joined"

This shouldn't be a function call, because the function call returns the actual datetime object each time a migration is run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: Timezone inaccuracies
3 participants